package com.anjie.powerproject.strategy.pojo.device;

import java.util.Arrays;

/**
 * 供能设备
 */
public class SupplyDevice extends BaseDevice {
    // 时间标记数组
    private int[] flag;
    // 能量数组
    private double[] power;

    private Integer supplyDeviceId;

    private String supplyDeviceName;

    private String storagyDeviceName;

    public SupplyDevice(Integer id, String name, int len) {
        super(id, name);
        flag = new int[len];
        power = new double[len];
    }

    public SupplyDevice(BaseDevice device, int len) {
        super(device.getId(), device.getName());
        flag = new int[len];
        power = new double[len];
    }

    public boolean hasRelease() {
        return Arrays.stream(flag).filter(item->item==1).sum() > 0;
    }

    public int[] getFlag() {
        return flag;
    }

    public void setFlag(int[] flag) {
        this.flag = flag;
    }

    public double[] getPower() {
        return power;
    }

    public void setPower(double[] power) {
        this.power = power;
    }

    public String getSupplyInfo() {
        return getName() + " 放能至 " + getSupplyDeviceName();
    }

    public void setSupplyDeviceName(String supplyDeviceName) {
        this.supplyDeviceName = supplyDeviceName;
    }

    public String getSupplyDeviceName() {
        return supplyDeviceName;
    }

    public void setStoragyDeviceName(String storagyDeviceName) {
        this.storagyDeviceName = storagyDeviceName;
    }

    public String getStoragyDeviceName() {
        return storagyDeviceName;
    }

    public Integer getSupplyDeviceId() {
        return supplyDeviceId;
    }

    public void setSupplyDeviceId(Integer supplyDeviceId) {
        this.supplyDeviceId = supplyDeviceId;
    }
}